home *** CD-ROM | disk | FTP | other *** search
/ Champak 33 / Volume 33 - JOGO DISK .iso / Games / showdown_noel.swf / scripts / frame_19 / DoAction_2.as next >
Text File  |  2007-01-15  |  71KB  |  2,685 lines

  1. function next_game()
  2. {
  3.    game_paused = true;
  4.    this.attachMovie("next_stage","next_stage",3);
  5. }
  6. function next_round()
  7. {
  8.    if(game_time > 0 and game_life > 0)
  9.    {
  10.       if(game_stage < 5)
  11.       {
  12.          game_stage++;
  13.       }
  14.       else
  15.       {
  16.          game_level++;
  17.          game_stage = 1;
  18.       }
  19.       trace("game_level    " + game_level + "   " + game_stage);
  20.       if(game_level <= 4)
  21.       {
  22.          _root.gotoAndStop("initial");
  23.       }
  24.       else
  25.       {
  26.          win_game();
  27.       }
  28.       if(game_level <= 4)
  29.       {
  30.          play_music("music_bg" + game_level,true);
  31.       }
  32.    }
  33.    else
  34.    {
  35.       lose_game();
  36.    }
  37. }
  38. function create_stage()
  39. {
  40.    bg.removeMovieClip();
  41.    game_ui.removeMovieClip();
  42.    var _loc2_ = this.attachMovie("bg","bg",1);
  43.    _loc2_.bg.gotoAndStop(game_level);
  44.    _loc2_.step.gotoAndStop((game_level - 1) * 5 + game_stage);
  45.    mission_end_count = 100;
  46.    var _loc3_ = this.attachMovie("Ui_infer","game_ui",2);
  47.    gotoAndStop("gaming");
  48. }
  49. function create_monsters(type, x, y)
  50. {
  51.    var _loc5_ = this.bg.getNextHighestDepth();
  52.    var _loc4_ = this.bg.createEmptyMovieClip("snow_shine" + _loc5_,_loc5_);
  53.    _loc4_._x = x;
  54.    _loc4_._y = y - 20;
  55.    var i = 1;
  56.    while(i <= 4)
  57.    {
  58.       var _loc3_ = _loc4_.attachMovie("snow","snow" + i,i);
  59.       _loc3_.gotoAndStop(4);
  60.       _loc3_.angle = i * 90 * 0.01745;
  61.       _loc3_._x = 30 * Math.sin(_loc3_.angle);
  62.       _loc3_._y = 30 * Math.cos(_loc3_.angle);
  63.       i++;
  64.    }
  65.    _loc4_.distance = 30;
  66.    _loc4_.onEnterFrame = function()
  67.    {
  68.       if(!_root.game_paused)
  69.       {
  70.          this.distance -= 2;
  71.          for(i in this)
  72.          {
  73.             this[i]._rotation += 20;
  74.             this[i]._x = this.distance * Math.sin(this[i].angle);
  75.             this[i]._y = this.distance * Math.cos(this[i].angle);
  76.          }
  77.          if(this.distance == 10)
  78.          {
  79.             var _loc3_ = this._parent.getNextHighestDepth();
  80.             var monster_mc = this._parent.attachMovie("monster" + type,"monster_" + type + "_" + _loc3_,_loc3_);
  81.             monster_mc._x = this._x;
  82.             monster_mc._y = this._y + 20;
  83.             monster_mc.swapDepths(this);
  84.             monster_mc.stop();
  85.             monster_mc.mc.stop();
  86.             monster_mc.count = 0;
  87.             monster_mc._xscale = 2.5;
  88.             monster_mc._yscale = 2.5;
  89.             monster_mc.type = type;
  90.             var _loc4_ = new Color(monster_mc);
  91.             _loc4_.setTransform(shine_Transform2);
  92.             if(this.cross_step != undefined)
  93.             {
  94.                monster_mc.cross_step = this.cross_step;
  95.             }
  96.             monster_mc.onEnterFrame = function()
  97.             {
  98.                if(!_root.game_paused)
  99.                {
  100.                   this.count += 2;
  101.                   monster_mc._xscale = 2.5 * this.count;
  102.                   monster_mc._yscale = 2.5 * this.count;
  103.                   if(this.count == 40)
  104.                   {
  105.                      var _loc3_ = new Color(this);
  106.                      _loc3_.setTransform(_root.shine_Transform1);
  107.                      this.mc.play();
  108.                      delete this.onEnterFrame;
  109.                      if(this.typ == "land")
  110.                      {
  111.                         land_monsterAI(this);
  112.                      }
  113.                      else if(this.typ == "fly")
  114.                      {
  115.                         fly_monsterAI(this);
  116.                      }
  117.                      else
  118.                      {
  119.                         _root["bossAI" + game_level](this);
  120.                      }
  121.                   }
  122.                }
  123.             };
  124.          }
  125.          else if(this.distance < 0)
  126.          {
  127.             this._alpha = Math.round((40 + this.distance) / 40 * 100);
  128.             if(this.distance == -10)
  129.             {
  130.                for(i in this)
  131.                {
  132.                   this[i].gotoAndStop(3);
  133.                }
  134.             }
  135.             else if(this.distance == -20)
  136.             {
  137.                for(i in this)
  138.                {
  139.                   this[i].gotoAndStop(2);
  140.                }
  141.             }
  142.             else if(this.distance == -30)
  143.             {
  144.                for(i in this)
  145.                {
  146.                   this[i].gotoAndStop(1);
  147.                }
  148.             }
  149.             else if(this.distance == -40)
  150.             {
  151.                this.removeMovieClip();
  152.             }
  153.          }
  154.       }
  155.    };
  156.    return _loc4_;
  157. }
  158. function create_big_snow(where, what, small, large)
  159. {
  160.    this.bg.hit_snow.removeMovieClip();
  161.    var _loc7_ = this.bg.getNextHighestDepth();
  162.    var _loc4_ = this.bg.createEmptyMovieClip("hit_snow" + _loc7_,_loc7_);
  163.    _loc4_._x = where._x;
  164.    _loc4_._y = where._y;
  165.    _loc4_.distance = small;
  166.    var i = 1;
  167.    while(i <= 4)
  168.    {
  169.       var _loc3_ = _loc4_.attachMovie("snow","snow" + i,i);
  170.       _loc3_.gotoAndStop(what);
  171.       _loc3_.angle = i * 90 * 0.01745;
  172.       _loc3_._x = small * Math.sin(_loc3_.angle);
  173.       _loc3_._y = small * Math.cos(_loc3_.angle);
  174.       i++;
  175.    }
  176.    _loc4_.onEnterFrame = function()
  177.    {
  178.       if(!_root.game_paused)
  179.       {
  180.          for(i in this)
  181.          {
  182.             this[i]._rotation += 20;
  183.             this[i]._x = this.distance * Math.sin(this[i].angle);
  184.             this[i]._y = this.distance * Math.cos(this[i].angle);
  185.          }
  186.          this._alpha = Math.round((1 - this.distance / large) * 100);
  187.          this.distance += 3;
  188.          if(this.distance > large)
  189.          {
  190.             for(i in this)
  191.             {
  192.                this[i].removeMovieClip();
  193.             }
  194.             if(this.myMission != undefined)
  195.             {
  196.                this.onEnterFrame = function()
  197.                {
  198.                   if(!_root.game_paused)
  199.                   {
  200.                      if(--mission_end_count < 0)
  201.                      {
  202.                         this.myMission();
  203.                         this.removeMovieClip();
  204.                      }
  205.                   }
  206.                };
  207.             }
  208.             else
  209.             {
  210.                this.removeMovieClip();
  211.             }
  212.          }
  213.       }
  214.    };
  215.    return _loc4_;
  216. }
  217. function create_land_snow(where)
  218. {
  219.    var _loc2_ = bg.getNextHighestDepth();
  220.    var _loc1_ = bg.attachMovie("land_snow","land_snow" + _loc2_,_loc2_);
  221.    _loc1_._x = where._x;
  222.    _loc1_._y = where._y;
  223. }
  224. function snow_down(where)
  225. {
  226.    where.wind_dir = 1;
  227.    var _loc4_ = 0;
  228.    while(_loc4_ <= 25)
  229.    {
  230.       var _loc3_ = where.getNextHighestDepth();
  231.       var _loc2_ = where.attachMovie("snow","snow" + _loc3_,_loc3_);
  232.       _loc2_.speed = random(3) + 3;
  233.       _loc2_._x = random(600) - 50;
  234.       _loc2_._y = random(400);
  235.       _loc2_.gotoAndStop(random(4) + 1);
  236.       _loc2_.onEnterFrame = function()
  237.       {
  238.          this._x += 1;
  239.          this._y += this.speed;
  240.          this._rotation += this.speed;
  241.          if(this._x > 580 or this._y > 420)
  242.          {
  243.             this.gotoAndStop(random(4) + 1);
  244.             this.speed = random(3) + 3;
  245.             this._x = random(600) - 50;
  246.             this._y = - random(-100);
  247.          }
  248.       };
  249.       _loc4_ = _loc4_ + 1;
  250.    }
  251. }
  252. function add_presents(where, typ, num)
  253. {
  254.    var _loc4_ = bg.getNextHighestDepth();
  255.    var _loc3_ = bg.attachMovie("presents","presents" + _loc4_,_loc4_);
  256.    _loc3_.living = true;
  257.    _loc3_.typ = typ;
  258.    _loc3_._x = Math.round(where._x);
  259.    _loc3_._y = Math.round(where._y);
  260.    _loc3_.special_array = ["power","range","life","speed","cchest"];
  261.    _loc3_.come_out = function()
  262.    {
  263.       if(typ == "fromChest")
  264.       {
  265.          this.typ = "presents";
  266.          this.gotoAndStop(num);
  267.       }
  268.       else if(typ == "presents" and random(3))
  269.       {
  270.          this.gotoAndStop(num);
  271.       }
  272.       else
  273.       {
  274.          this.typ = this.special_array[random(5)];
  275.          this.gotoAndStop(this.typ);
  276.       }
  277.       play_sound("present_out");
  278.       var xspeed = random(20) - random(20);
  279.       this.onEnterFrame = function()
  280.       {
  281.          if(!_root.game_paused)
  282.          {
  283.             moveAction(this,xspeed,-11 - random(this._y / 35));
  284.             if(this.states == "stand")
  285.             {
  286.                this.find_player();
  287.                if(this.typ == "cchest")
  288.                {
  289.                   this.health = 10;
  290.                   this.to_die = function()
  291.                   {
  292.                      if(this.health > 0)
  293.                      {
  294.                         this.gotoAndStop("ochest");
  295.                         this.health = this.health - 1;
  296.                         if(this.health > 0)
  297.                         {
  298.                            add_presents(this,"fromChest",random(10) + 1);
  299.                         }
  300.                         else
  301.                         {
  302.                            this.onEnterFrame = function()
  303.                            {
  304.                               if(!_root.game_paused)
  305.                               {
  306.                                  this._alpha -= 5;
  307.                                  if(this._alpha < 5)
  308.                                  {
  309.                                     this.removeMovieClip();
  310.                                  }
  311.                               }
  312.                            };
  313.                         }
  314.                      }
  315.                   };
  316.                }
  317.             }
  318.          }
  319.       };
  320.    };
  321.    _loc3_.find_player = function()
  322.    {
  323.       this.exist_count = 0;
  324.       this.find_count = 0;
  325.       this.onEnterFrame = function()
  326.       {
  327.          if(!_root.game_paused)
  328.          {
  329.             if(++this.exist_count > 80)
  330.             {
  331.                var _loc3_ = this.exist_count % 2;
  332.                if(_loc3_)
  333.                {
  334.                   this._alpha = 50;
  335.                }
  336.                else
  337.                {
  338.                   this._alpha = 100;
  339.                }
  340.                if(this.exist_count > 130)
  341.                {
  342.                   this.removeMovieClip();
  343.                }
  344.             }
  345.             if(this.hitTest(bg.santa.g))
  346.             {
  347.                this._alpha = 100;
  348.                if(this.typ == "presents")
  349.                {
  350.                   game_score += Number(this.score);
  351.                   adjust_score(_root.game_ui);
  352.                   this.gotoAndStop("score");
  353.                   play_sound("bonus_sound");
  354.                }
  355.                else if(this.typ == "power")
  356.                {
  357.                   if(game_power < 2)
  358.                   {
  359.                      game_power = 2;
  360.                      this.gotoAndStop(this.typ + "_out");
  361.                      play_sound("upgrade");
  362.                   }
  363.                   else
  364.                   {
  365.                      game_score += Number(this.score);
  366.                      adjust_score(_root.game_ui);
  367.                      this.gotoAndStop("score");
  368.                      play_sound("bonus_sound");
  369.                   }
  370.                }
  371.                else if(this.typ == "range")
  372.                {
  373.                   if(game_range < 20)
  374.                   {
  375.                      game_range = 20;
  376.                      this.gotoAndStop(this.typ + "_out");
  377.                      play_sound("upgrade");
  378.                   }
  379.                   else
  380.                   {
  381.                      game_score += Number(this.score);
  382.                      adjust_score(_root.game_ui);
  383.                      this.gotoAndStop("score");
  384.                      play_sound("bonus_sound");
  385.                   }
  386.                }
  387.                else if(this.typ == "life")
  388.                {
  389.                   if(game_life < 10)
  390.                   {
  391.                      game_life++;
  392.                      adjust_life(_root.game_ui);
  393.                      this.gotoAndStop(this.typ + "_out");
  394.                      play_sound("upgrade");
  395.                   }
  396.                   else
  397.                   {
  398.                      game_score += Number(this.score);
  399.                      adjust_score(_root.game_ui);
  400.                      this.gotoAndStop("score");
  401.                      play_sound("bonus_sound");
  402.                   }
  403.                }
  404.                else if(this.typ == "speed")
  405.                {
  406.                   if(game_speed < 6)
  407.                   {
  408.                      game_speed = 6;
  409.                      this.gotoAndStop(this.typ + "_out");
  410.                      play_sound("upgrade");
  411.                   }
  412.                   else
  413.                   {
  414.                      game_score += Number(this.score);
  415.                      adjust_score(_root.game_ui);
  416.                      this.gotoAndStop("score");
  417.                      play_sound("bonus_sound");
  418.                   }
  419.                }
  420.                else if(this.typ == "cchest")
  421.                {
  422.                   game_score += Number(this.score);
  423.                   adjust_score(_root.game_ui);
  424.                   this.gotoAndStop("score");
  425.                   play_sound("bonus_sound");
  426.                }
  427.                this._x = bg.santa._x;
  428.                this.onEnterFrame = function()
  429.                {
  430.                   if(!_root.game_paused)
  431.                   {
  432.                      this._y -= 2;
  433.                      if(++this.find_count == 20)
  434.                      {
  435.                         this.removeMovieClip();
  436.                      }
  437.                   }
  438.                };
  439.             }
  440.          }
  441.       };
  442.    };
  443.    _loc3_.show_score = function(which)
  444.    {
  445.       var _loc5_ = 100000 + this.score;
  446.       var _loc4_ = this.score.toString().length;
  447.       if(which > _loc4_)
  448.       {
  449.          this["num" + which]._visible = 0;
  450.       }
  451.       else
  452.       {
  453.          var _loc3_ = Number(_loc5_.toString().slice(6 - which,7 - which));
  454.          this["num" + which].gotoAndStop(_loc3_ + 1);
  455.       }
  456.    };
  457.    _loc3_.come_out();
  458.    return _loc3_;
  459. }
  460. function adjust_life(where)
  461. {
  462.    if(game_life > 10)
  463.    {
  464.       where.life.gotoAndStop(10);
  465.    }
  466.    else if(game_life > 0 and game_life <= 10)
  467.    {
  468.       where.life.gotoAndStop(game_life);
  469.    }
  470.    else
  471.    {
  472.       where.life._visible = 0;
  473.    }
  474. }
  475. function adjust_score(where)
  476. {
  477.    var _loc1_ = 100000000 + game_score;
  478.    var _loc10_ = Number(_loc1_.toString().slice(8,9)) + 1;
  479.    var _loc9_ = Number(_loc1_.toString().slice(7,8)) + 1;
  480.    var _loc8_ = Number(_loc1_.toString().slice(6,7)) + 1;
  481.    var _loc7_ = Number(_loc1_.toString().slice(5,6)) + 1;
  482.    var _loc6_ = Number(_loc1_.toString().slice(4,5)) + 1;
  483.    var _loc5_ = Number(_loc1_.toString().slice(3,4)) + 1;
  484.    var _loc4_ = Number(_loc1_.toString().slice(2,3)) + 1;
  485.    var _loc3_ = Number(_loc1_.toString().slice(1,2)) + 1;
  486.    where.num1.gotoAndStop(_loc10_);
  487.    where.num10.gotoAndStop(_loc9_);
  488.    where.num100.gotoAndStop(_loc8_);
  489.    where.num1000.gotoAndStop(_loc7_);
  490.    where.num10000.gotoAndStop(_loc6_);
  491.    where.num100000.gotoAndStop(_loc5_);
  492.    where.num1000000.gotoAndStop(_loc4_);
  493.    where.num10000000.gotoAndStop(_loc3_);
  494. }
  495. function adjust_boss(where)
  496. {
  497.    if(game_stage <= 4)
  498.    {
  499.       where.boss.swapDepths(1000);
  500.       where.boss.removeMovieClip();
  501.    }
  502.    else
  503.    {
  504.       var _loc3_ = this["game_boss" + game_level + "_health"];
  505.       if(_loc3_ > 0)
  506.       {
  507.          where.boss.gotoAndStop(this["game_boss" + game_level + "_health"]);
  508.       }
  509.       else
  510.       {
  511.          where.boss._visible = 0;
  512.       }
  513.    }
  514. }
  515. function adjust_time(where)
  516. {
  517.    if(game_stage <= 4)
  518.    {
  519.       game_time = 60;
  520.    }
  521.    else
  522.    {
  523.       game_time = 99;
  524.    }
  525.    where.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
  526.    where.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
  527.    where.time_count = 0;
  528.    where.onEnterFrame = function()
  529.    {
  530.       if(!_root.game_paused)
  531.       {
  532.          if(monsters_exist > 0)
  533.          {
  534.             if(++this.time_count == 80)
  535.             {
  536.                this.time_count = 0;
  537.                if(game_time > 0)
  538.                {
  539.                   game_time--;
  540.                   if(game_time >= 0)
  541.                   {
  542.                      this.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
  543.                      this.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
  544.                   }
  545.                   if(game_time == 0)
  546.                   {
  547.                      create_big_snow(bg.santa,4,8,100);
  548.                      bg.santa.gotoAndStop("hit");
  549.                      bg.santa.onEnterFrame = function()
  550.                      {
  551.                         if(!_root.game_paused)
  552.                         {
  553.                            this._alpha -= 1;
  554.                            if(this._alpha <= 0)
  555.                            {
  556.                               next_game();
  557.                               delete this.onEnterFrame;
  558.                            }
  559.                         }
  560.                      };
  561.                   }
  562.                }
  563.             }
  564.             else if(game_time < 10)
  565.             {
  566.                var _loc3_ = new Color(this.time10);
  567.                var _loc4_ = new Color(this.time1);
  568.                if(this.time_count % 2 == 0)
  569.                {
  570.                   _loc3_.setTransform(shine_Transform2);
  571.                   _loc4_.setTransform(shine_Transform2);
  572.                }
  573.                else
  574.                {
  575.                   _loc3_.setTransform(shine_Transform1);
  576.                   _loc4_.setTransform(shine_Transform1);
  577.                }
  578.             }
  579.          }
  580.       }
  581.    };
  582. }
  583. function win_game()
  584. {
  585.    bg.removeMovieClip();
  586.    game_ui.removeMovieClip();
  587.    play_music("music_win",true);
  588.    gotoAndStop("win");
  589. }
  590. function lose_game()
  591. {
  592.    bg.removeMovieClip();
  593.    game_ui.removeMovieClip();
  594.    play_music("music_lose",false);
  595.    music_lose.onSoundComplete = function()
  596.    {
  597.       play_music("music_op",true);
  598.    };
  599.    gotoAndStop("lose");
  600. }
  601. function init_control_btns(where)
  602. {
  603.    where.play_btn.gotoAndStop(1);
  604.    where.play_btn.onPress = function()
  605.    {
  606.       play_sound("button_sound");
  607.       this._y = this._y + 1;
  608.       if(monsters_exist > 0)
  609.       {
  610.          if(game_paused)
  611.          {
  612.             for(var _loc2_ in bg)
  613.             {
  614.                if(bg[_loc2_].living)
  615.                {
  616.                   if(bg[_loc2_].attack != undefined)
  617.                   {
  618.                      bg[_loc2_].mc.play();
  619.                   }
  620.                }
  621.             }
  622.             game_paused = false;
  623.             this.gotoAndStop(1);
  624.          }
  625.          else
  626.          {
  627.             for(_loc2_ in bg)
  628.             {
  629.                if(bg[_loc2_].living)
  630.                {
  631.                   if(bg[_loc2_].attack != undefined)
  632.                   {
  633.                      bg[_loc2_].mc.stop();
  634.                   }
  635.                }
  636.             }
  637.             game_paused = true;
  638.             this.gotoAndStop(2);
  639.          }
  640.       }
  641.    };
  642.    where.play_btn.onRelease = where.play_btn.onReleaseOutside = function()
  643.    {
  644.       this._y = this._y - 1;
  645.    };
  646.    if(game_music)
  647.    {
  648.       where.sound_btn.gotoAndStop(1);
  649.    }
  650.    else
  651.    {
  652.       where.sound_btn.gotoAndStop(2);
  653.    }
  654.    where.sound_btn.onPress = function()
  655.    {
  656.       play_sound("button_sound");
  657.       this._y = this._y + 1;
  658.       if(game_music)
  659.       {
  660.          game_music = false;
  661.          stopAllSounds();
  662.          this.gotoAndStop(2);
  663.       }
  664.       else
  665.       {
  666.          game_music = true;
  667.          music_resume = true;
  668.          play_music(now_music,true);
  669.          this.gotoAndStop(1);
  670.       }
  671.    };
  672.    where.sound_btn.onRelease = where.sound_btn.onReleaseOutside = function()
  673.    {
  674.       this._y = this._y - 1;
  675.    };
  676.    where.play_btn.enabled = false;
  677.    where.sound_btn.enabled = false;
  678. }
  679. function moveAction(who, xspeed, yspeed)
  680. {
  681.    if(who.yspeed == undefined)
  682.    {
  683.       who.yspeed = yspeed;
  684.    }
  685.    var _loc3_ = false;
  686.    if(who.yspeed >= 0)
  687.    {
  688.       if(who.cross_step > 0)
  689.       {
  690.          who.cross_step = who.cross_step - 1;
  691.       }
  692.       else if(who.living)
  693.       {
  694.          if(bg.step.hitTest(who._x,who._y + 15,true))
  695.          {
  696.             if(!bg.step.hitTest(who._x,who._y - 15,true))
  697.             {
  698.                _loc3_ = true;
  699.                adjustY(who,bg.step);
  700.             }
  701.          }
  702.       }
  703.       else if(bg.step.hitTest(who._x,who._y + 45,true))
  704.       {
  705.          if(!bg.step.hitTest(who._x,who._y + 15,true))
  706.          {
  707.             _loc3_ = true;
  708.             adjustY(who,bg.step);
  709.          }
  710.       }
  711.    }
  712.    if(_loc3_ and who.yspeed >= 0)
  713.    {
  714.       who.states = "stand";
  715.       delete who.yspeed;
  716.    }
  717.    if(!_loc3_ or who.yspeed < 0)
  718.    {
  719.       if(who.yspeed < 10)
  720.       {
  721.          who.yspeed += 0.75;
  722.       }
  723.       who._y += who.yspeed;
  724.       if(who._y > 400 + who._height)
  725.       {
  726.          who._y = 0;
  727.       }
  728.       who.states = "jump";
  729.    }
  730.    who.hit_ground = _loc3_;
  731.    var _loc4_ = false;
  732.    if(who.attack != undefined)
  733.    {
  734.       if(who.living)
  735.       {
  736.          if(bg.step.hitTest(who._x + xspeed,who._y - 15,true))
  737.          {
  738.             _loc4_ = true;
  739.          }
  740.       }
  741.       else if(bg.step.hitTest(who._x + xspeed,who._y,true))
  742.       {
  743.          _loc4_ = true;
  744.       }
  745.    }
  746.    if(_loc4_)
  747.    {
  748.       who.get_blocked();
  749.    }
  750.    else if(who.states == "stand")
  751.    {
  752.       if(who._x + xspeed > 20 and who._x + xspeed < 530)
  753.       {
  754.          who._x += xspeed;
  755.       }
  756.    }
  757.    else if(who._x + xspeed / 2 > 20 and who._x + xspeed / 2 < 530)
  758.    {
  759.       who._x += xspeed / 2;
  760.    }
  761.    who.hit_blocks = _loc4_;
  762.    if(who.living)
  763.    {
  764.       var _loc6_ = false;
  765.       if(bg.step.hitTest(who._x,who._y - 65,true))
  766.       {
  767.          if(!bg.step.hitTest(who._x,who._y - 85,true))
  768.          {
  769.             _loc6_ = true;
  770.          }
  771.       }
  772.       who.can_jump = _loc6_;
  773.       var _loc5_ = false;
  774.       if(bg.step.hitTest(who._x,who._y + 15,true))
  775.       {
  776.          if(!bg.step.hitTest(who._x,who._y + 30,true))
  777.          {
  778.             _loc5_ = true;
  779.          }
  780.       }
  781.       if(who._y < stage_down_max)
  782.       {
  783.          who.can_down = _loc5_;
  784.       }
  785.       var _loc7_ = false;
  786.       if(!bg.step.hitTest(who._x + xspeed,who._y + 15,true))
  787.       {
  788.          _loc7_ = true;
  789.       }
  790.       who.ahead_down = _loc7_;
  791.    }
  792.    if(who.attack != undefined)
  793.    {
  794.       if(who.living)
  795.       {
  796.          if(who.g.hitTest(bg.santa.g))
  797.          {
  798.             bg.santa.to_die();
  799.          }
  800.       }
  801.    }
  802. }
  803. function adjustY(who, where)
  804. {
  805.    if(who.living)
  806.    {
  807.       var _loc4_ = 0;
  808.    }
  809.    else
  810.    {
  811.       _loc4_ = 30;
  812.    }
  813.    var _loc3_ = 5;
  814.    while(_loc3_ >= 1)
  815.    {
  816.       if(!where.hitTest(who._x,who._y + _loc4_ + _loc3_ - 1,true))
  817.       {
  818.          who._y += _loc3_;
  819.       }
  820.       else
  821.       {
  822.          _loc3_ = _loc3_ - 1;
  823.       }
  824.    }
  825.    var _loc2_ = 5;
  826.    while(_loc2_ >= 1)
  827.    {
  828.       if(where.hitTest(who._x,who._y + _loc4_ - _loc2_,true))
  829.       {
  830.          who._y -= _loc2_;
  831.       }
  832.       else
  833.       {
  834.          _loc2_ = _loc2_ - 1;
  835.       }
  836.    }
  837. }
  838. function land_monsterAI(who)
  839. {
  840.    who.speed = -2;
  841.    who.states = "stand";
  842.    who.living = true;
  843.    who.turn = function()
  844.    {
  845.       if(this.states == "stand")
  846.       {
  847.          this.gotoAndStop("turn");
  848.          this.onEnterFrame = function()
  849.          {
  850.             if(!_root.game_paused)
  851.             {
  852.                if(this.mc._currentframe == this.mc._totalframes)
  853.                {
  854.                   this._xscale *= -1;
  855.                   this.move_me();
  856.                }
  857.             }
  858.          };
  859.       }
  860.    };
  861.    who.get_blocked = function()
  862.    {
  863.       if(this.living)
  864.       {
  865.          if(random(2))
  866.          {
  867.             this.jump(1);
  868.          }
  869.          else
  870.          {
  871.             this.turn();
  872.          }
  873.       }
  874.    };
  875.    who.jump = function(how)
  876.    {
  877.       this.gotoAndStop("jump");
  878.       if(how == -1)
  879.       {
  880.          this.onEnterFrame = function()
  881.          {
  882.             if(!_root.game_paused)
  883.             {
  884.                moveAction(this,0,-12);
  885.                if(who.states == "stand")
  886.                {
  887.                   create_land_snow(this);
  888.                   this.move_me();
  889.                }
  890.             }
  891.          };
  892.       }
  893.       else if(how == 1)
  894.       {
  895.          this.cross_step = 5;
  896.          this.onEnterFrame = function()
  897.          {
  898.             if(!_root.game_paused)
  899.             {
  900.                moveAction(this,0,1);
  901.                if(who.states == "stand")
  902.                {
  903.                   create_land_snow(this);
  904.                   this.move_me();
  905.                }
  906.             }
  907.          };
  908.       }
  909.    };
  910.    who.move_me = function()
  911.    {
  912.       this.gotoAndStop("walk");
  913.       if(!this.init)
  914.       {
  915.          this.init = true;
  916.          this._xscale = (1 - random(2) * 2) * 100;
  917.       }
  918.       this.onEnterFrame = function()
  919.       {
  920.          if(!_root.game_paused)
  921.          {
  922.             moveAction(this,this.speed * this._xscale / 100,0);
  923.             if(who._x + this.speed * this._xscale / 100 > stage_max)
  924.             {
  925.                who.turn();
  926.             }
  927.             else if(who._x + this.speed * this._xscale / 100 < stage_min)
  928.             {
  929.                who.turn();
  930.             }
  931.             else if(who.hit_blocks)
  932.             {
  933.                who.turn();
  934.             }
  935.             else if(who.ahead_down)
  936.             {
  937.                if(random(3))
  938.                {
  939.                   who.turn();
  940.                }
  941.             }
  942.             if(who.states == "stand")
  943.             {
  944.                if(!random(80))
  945.                {
  946.                   if(who.can_jump)
  947.                   {
  948.                      who.jump(-1);
  949.                   }
  950.                }
  951.                else if(!random(120))
  952.                {
  953.                   if(who.can_down)
  954.                   {
  955.                      who.jump(1);
  956.                   }
  957.                }
  958.                else if(!random(60))
  959.                {
  960.                   if(this.attack)
  961.                   {
  962.                      who.attacking();
  963.                   }
  964.                }
  965.             }
  966.          }
  967.       };
  968.    };
  969.    who.attacking = function()
  970.    {
  971.       this.gotoAndStop("attack");
  972.       this.action_count = 0;
  973.       this.onEnterFrame = function()
  974.       {
  975.          if(!_root.game_paused)
  976.          {
  977.             if(++this.action_count > 35)
  978.             {
  979.                this.move_me();
  980.             }
  981.             else if(who.mc.weapon.hitTest(bg.santa.g))
  982.             {
  983.                bg.santa.to_die();
  984.             }
  985.          }
  986.       };
  987.    };
  988.    who.to_die = function()
  989.    {
  990.       if(this.living)
  991.       {
  992.          who.gotoAndStop("hit");
  993.          who.freeze_count = 0;
  994.          if(who.iceball == undefined)
  995.          {
  996.             who.attachMovie("iceball","iceball",this.getNextHighestDepth());
  997.             who.iceball.gotoAndStop(1);
  998.             who.onEnterFrame = function()
  999.             {
  1000.                if(!_root.game_paused)
  1001.                {
  1002.                   if(this.living)
  1003.                   {
  1004.                      this.freeze_count = this.freeze_count + 1;
  1005.                      if(this.freeze_count == 100)
  1006.                      {
  1007.                         this.freeze_count = 0;
  1008.                         if(this.iceball._currentframe > 1)
  1009.                         {
  1010.                            this.iceball.prevFrame();
  1011.                            this.mc.play();
  1012.                         }
  1013.                         else
  1014.                         {
  1015.                            this.iceball.removeMovieClip();
  1016.                            this.move_me();
  1017.                         }
  1018.                      }
  1019.                   }
  1020.                }
  1021.             };
  1022.          }
  1023.          else if(game_power == 1)
  1024.          {
  1025.             if(who.iceball._currentframe < 5)
  1026.             {
  1027.                who.iceball.nextFrame();
  1028.             }
  1029.             else
  1030.             {
  1031.                who.iceball.gotoAndStop(6);
  1032.                who.mc.stop();
  1033.             }
  1034.          }
  1035.          else if(game_power == 2)
  1036.          {
  1037.             if(who.iceball._currentframe < 4)
  1038.             {
  1039.                who.iceball.gotoAndStop(who.iceball._currentframe + 3);
  1040.             }
  1041.             else
  1042.             {
  1043.                who.iceball.gotoAndStop(6);
  1044.                who.mc.stop();
  1045.             }
  1046.          }
  1047.       }
  1048.    };
  1049.    who.monster_dead = function()
  1050.    {
  1051.       monsters_exist--;
  1052.       var _loc5_ = bg.getNextHighestDepth();
  1053.       var _loc4_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc5_,_loc5_);
  1054.       _loc4_._x = this._x;
  1055.       _loc4_._y = this._y;
  1056.       create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
  1057.       var _loc3_ = random(this.type + 2) + 1;
  1058.       if(_loc3_ > 8)
  1059.       {
  1060.          _loc3_ = 8;
  1061.       }
  1062.       game_score += 100 * this.type;
  1063.       adjust_score(_root.game_ui);
  1064.       if(this.living)
  1065.       {
  1066.          add_presents(this,"presents",_loc3_);
  1067.       }
  1068.       this.removeMovieClip();
  1069.    };
  1070.    who.move_me();
  1071. }
  1072. function fly_monsterAI(who)
  1073. {
  1074.    who.speed = 1;
  1075.    who.states = "stand";
  1076.    who.living = true;
  1077.    who.turn = function()
  1078.    {
  1079.       this.gotoAndStop("turn");
  1080.       this.onEnterFrame = function()
  1081.       {
  1082.          if(!_root.game_paused)
  1083.          {
  1084.             if(this.mc._currentframe == this.mc._totalframes)
  1085.             {
  1086.                this._xscale *= -1;
  1087.                this.move_me();
  1088.             }
  1089.          }
  1090.       };
  1091.    };
  1092.    who.move_me = function()
  1093.    {
  1094.       this.gotoAndStop("walk");
  1095.       if(!this.init)
  1096.       {
  1097.          this.init = true;
  1098.          this._xscale = (1 - random(2) * 2) * 100;
  1099.       }
  1100.       this.onEnterFrame = function()
  1101.       {
  1102.          if(!_root.game_paused)
  1103.          {
  1104.             this._x += this.speed * (bg.santa._x - this._x) / Math.abs(bg.santa._x - this._x);
  1105.             this._y += this.speed * (bg.santa._y - this._y) / Math.abs(bg.santa._y - this._y);
  1106.             if(this._xscale == 100)
  1107.             {
  1108.                if(bg.santa._x - this._x > 5)
  1109.                {
  1110.                   this.turn();
  1111.                }
  1112.             }
  1113.             else if(this._xscale == -100)
  1114.             {
  1115.                if(bg.santa._x - this._x < 5)
  1116.                {
  1117.                   this.turn();
  1118.                }
  1119.             }
  1120.             if(this.g.hitTest(bg.santa.g))
  1121.             {
  1122.                bg.santa.to_die();
  1123.             }
  1124.             if(!random(60))
  1125.             {
  1126.                this.attacking();
  1127.             }
  1128.          }
  1129.       };
  1130.    };
  1131.    who.attacking = function()
  1132.    {
  1133.       this.gotoAndStop("attack");
  1134.       this.action_count = 0;
  1135.       this.onEnterFrame = function()
  1136.       {
  1137.          if(!_root.game_paused)
  1138.          {
  1139.             if(++this.action_count > 35)
  1140.             {
  1141.                this.move_me();
  1142.             }
  1143.             else if(who.mc.weapon.hitTest(bg.santa.g))
  1144.             {
  1145.                bg.santa.to_die();
  1146.             }
  1147.          }
  1148.       };
  1149.    };
  1150.    who.to_die = function()
  1151.    {
  1152.       if(this.living)
  1153.       {
  1154.          who.gotoAndStop("hit");
  1155.          who.freeze_count = 0;
  1156.          if(who.iceball == undefined)
  1157.          {
  1158.             who.attachMovie("iceball","iceball",this.getNextHighestDepth());
  1159.             who.iceball.gotoAndStop(1);
  1160.             who.onEnterFrame = function()
  1161.             {
  1162.                if(!_root.game_paused)
  1163.                {
  1164.                   if(this.living)
  1165.                   {
  1166.                      this.freeze_count = this.freeze_count + 1;
  1167.                      if(this.freeze_count == 100)
  1168.                      {
  1169.                         this.freeze_count = 0;
  1170.                         if(this.iceball._currentframe > 1)
  1171.                         {
  1172.                            this.iceball.prevFrame();
  1173.                            this.mc.play();
  1174.                         }
  1175.                         else
  1176.                         {
  1177.                            this.iceball.removeMovieClip();
  1178.                            this.move_me();
  1179.                         }
  1180.                      }
  1181.                   }
  1182.                }
  1183.             };
  1184.          }
  1185.          else if(game_power == 1)
  1186.          {
  1187.             if(who.iceball._currentframe < 5)
  1188.             {
  1189.                who.iceball.nextFrame();
  1190.             }
  1191.             else
  1192.             {
  1193.                who.iceball.gotoAndStop(6);
  1194.                who.mc.stop();
  1195.             }
  1196.          }
  1197.          else if(game_power == 2)
  1198.          {
  1199.             if(who.iceball._currentframe < 4)
  1200.             {
  1201.                who.iceball.gotoAndStop(who.iceball._currentframe + 3);
  1202.             }
  1203.             else
  1204.             {
  1205.                who.iceball.gotoAndStop(6);
  1206.                who.mc.stop();
  1207.             }
  1208.          }
  1209.       }
  1210.    };
  1211.    who.monster_dead = function()
  1212.    {
  1213.       monsters_exist--;
  1214.       var _loc5_ = bg.getNextHighestDepth();
  1215.       var _loc4_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc5_,_loc5_);
  1216.       _loc4_._x = this._x;
  1217.       _loc4_._y = this._y;
  1218.       create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
  1219.       var _loc3_ = random(this.type + 2) + 1;
  1220.       if(_loc3_ > 8)
  1221.       {
  1222.          _loc3_ = 8;
  1223.       }
  1224.       game_score += 100 * this.type;
  1225.       adjust_score(_root.game_ui);
  1226.       if(this.living)
  1227.       {
  1228.          add_presents(this,"presents",_loc3_);
  1229.       }
  1230.       this.removeMovieClip();
  1231.    };
  1232.    who.move_me();
  1233. }
  1234. function create_player()
  1235. {
  1236.    var _loc8_ = bg.getNextHighestDepth();
  1237.    var _loc5_ = bg.attachMovie("santa","santa",_loc8_);
  1238.    _loc5_._x = 75;
  1239.    _loc5_._y = 375;
  1240.    _loc5_.speed_rate = 0;
  1241.    _loc5_.living = true;
  1242.    _loc5_.unbreak = false;
  1243.    _loc5_.attack = true;
  1244.    _loc5_.to_die = function()
  1245.    {
  1246.       if(!this.unbreak)
  1247.       {
  1248.          game_life--;
  1249.          adjust_life(_root.game_ui);
  1250.          game_power = org_game_power;
  1251.          game_range = org_game_range;
  1252.          game_speed = org_game_speed;
  1253.          play_sound("santa_hit" + random(2));
  1254.          this.gotoAndStop("hit");
  1255.          unbreakAction(this);
  1256.          this.die_count = 0;
  1257.          this.onEnterFrame = function()
  1258.          {
  1259.             if(!_root.game_paused)
  1260.             {
  1261.                if(++this.die_count >= 20)
  1262.                {
  1263.                   this.die_count = 0;
  1264.                   if(game_life > 0)
  1265.                   {
  1266.                      this.gotoAndStop("stand");
  1267.                      this.doing = false;
  1268.                      this.gaming();
  1269.                   }
  1270.                   else
  1271.                   {
  1272.                      create_big_snow(this,4,8,100);
  1273.                      this.onEnterFrame = function()
  1274.                      {
  1275.                         if(!_root.game_paused)
  1276.                         {
  1277.                            this._alpha -= 3;
  1278.                            if(this._alpha <= 0)
  1279.                            {
  1280.                               next_game();
  1281.                               delete this.onEnterFrame;
  1282.                            }
  1283.                         }
  1284.                      };
  1285.                   }
  1286.                }
  1287.             }
  1288.          };
  1289.       }
  1290.    };
  1291.    _loc5_.gaming = function()
  1292.    {
  1293.       this.onEnterFrame = function()
  1294.       {
  1295.          if(!_root.game_paused)
  1296.          {
  1297.             gameControl(this);
  1298.          }
  1299.       };
  1300.    };
  1301.    _loc5_.gaming();
  1302.    var _loc4_ = bg.step.Ma;
  1303.    var _loc6_ = _loc4_.length;
  1304.    monsters_exist = _loc6_;
  1305.    monster_all = monsters_exist;
  1306.    var _loc3_ = 0;
  1307.    while(_loc3_ < _loc6_)
  1308.    {
  1309.       create_monsters(_loc4_[_loc3_][0],_loc4_[_loc3_][1],_loc4_[_loc3_][2]);
  1310.       _loc3_ = _loc3_ + 1;
  1311.    }
  1312.    _loc8_ = bg.getNextHighestDepth();
  1313.    var _loc7_ = bg.attachMovie("show_levels","show_levels",_loc8_);
  1314.    _loc7_.stop();
  1315.    _loc7_.onEnterFrame = function()
  1316.    {
  1317.       if(next_stage == undefined)
  1318.       {
  1319.          this.play();
  1320.          delete this.onEnterFrame;
  1321.       }
  1322.    };
  1323. }
  1324. function unbreakAction(who)
  1325. {
  1326.    who.unbreak = true;
  1327.    if(game_life > 0)
  1328.    {
  1329.       var _loc3_ = who.createEmptyMovieClip("unbreakMC",who.getNextHighestDepth());
  1330.       _loc3_.unbreak_start = 0;
  1331.       _loc3_.onEnterFrame = function()
  1332.       {
  1333.          if(!_root.game_paused)
  1334.          {
  1335.             this.unbreak_start = this.unbreak_start + 1;
  1336.             var _loc3_ = this.unbreak_start % 10;
  1337.             if(_loc3_ < 5)
  1338.             {
  1339.                this._parent._alpha = 60;
  1340.             }
  1341.             else
  1342.             {
  1343.                this._parent._alpha = 100;
  1344.             }
  1345.             if(this.unbreak_start > 150)
  1346.             {
  1347.                this._parent._alpha = 100;
  1348.                this._parent.unbreak = false;
  1349.                this.removeMovieClip();
  1350.             }
  1351.          }
  1352.       };
  1353.    }
  1354. }
  1355. function gameControl(who)
  1356. {
  1357.    if(!who.get_hit)
  1358.    {
  1359.       if(Key.isDown(Acode))
  1360.       {
  1361.          key_AD_Action(who,-1);
  1362.       }
  1363.       else if(Key.isDown(Dcode))
  1364.       {
  1365.          key_AD_Action(who,1);
  1366.       }
  1367.       else
  1368.       {
  1369.          normalAction_AD(who);
  1370.       }
  1371.       if(Key.isDown(Jcode))
  1372.       {
  1373.          if(!Jcode_pressed)
  1374.          {
  1375.             Jcode_pressed = true;
  1376.             key_J_Action(who);
  1377.          }
  1378.       }
  1379.       else
  1380.       {
  1381.          Jcode_pressed = false;
  1382.       }
  1383.       if(Key.isDown(Wcode))
  1384.       {
  1385.          if(!Wcode_pressed)
  1386.          {
  1387.             Wcode_pressed = true;
  1388.             key_W_Action(who);
  1389.          }
  1390.       }
  1391.       else
  1392.       {
  1393.          Wcode_pressed = false;
  1394.          if(Key.isDown(Scode))
  1395.          {
  1396.             if(!Scode_pressed)
  1397.             {
  1398.                Scode_pressed = true;
  1399.                key_S_Action(who);
  1400.             }
  1401.          }
  1402.          else
  1403.          {
  1404.             Scode_pressed = false;
  1405.          }
  1406.       }
  1407.    }
  1408.    playerMove(who,game_speed * who.speed_rate,0);
  1409. }
  1410. function playerMove(who, xspeed, yspeed)
  1411. {
  1412.    if(who.yspeed == undefined)
  1413.    {
  1414.       who.yspeed = yspeed;
  1415.    }
  1416.    var _loc3_ = false;
  1417.    if(who.yspeed >= 0)
  1418.    {
  1419.       if(who.cross_step > 0)
  1420.       {
  1421.          who.cross_step = who.cross_step - 1;
  1422.       }
  1423.       else if(bg.step.hitTest(who._x,who._y + 15,true))
  1424.       {
  1425.          if(!bg.step.hitTest(who._x,who._y - 15,true))
  1426.          {
  1427.             _loc3_ = true;
  1428.             adjustY(who,bg.step);
  1429.          }
  1430.       }
  1431.    }
  1432.    if(_loc3_ and who.yspeed >= 0)
  1433.    {
  1434.       who.states = "stand";
  1435.       delete who.yspeed;
  1436.    }
  1437.    if(!_loc3_ or who.yspeed < 0)
  1438.    {
  1439.       who.states = "jump";
  1440.       if(who.yspeed < 10)
  1441.       {
  1442.          who.yspeed += 0.75;
  1443.       }
  1444.       who._y += who.yspeed;
  1445.       if(who._y > 400 + who._height)
  1446.       {
  1447.          who._y = 0;
  1448.       }
  1449.    }
  1450.    var _loc4_ = false;
  1451.    if(bg.step.hitTest(who._x + xspeed * 2,who._y,true))
  1452.    {
  1453.       if(bg.step.hitTest(who._x + xspeed,who._y - 30,true))
  1454.       {
  1455.          _loc4_ = true;
  1456.       }
  1457.    }
  1458.    if(!_loc4_)
  1459.    {
  1460.       if(who._x + xspeed > 10 and who._x + xspeed < 540)
  1461.       {
  1462.          who._x += xspeed;
  1463.       }
  1464.    }
  1465. }
  1466. function key_W_Action(who)
  1467. {
  1468.    if(who.states == "stand")
  1469.    {
  1470.       if(who._currentframe != 25)
  1471.       {
  1472.          who.doing = true;
  1473.          who.yspeed = -11;
  1474.          who.gotoAndStop("jump");
  1475.          play_sound("jump");
  1476.       }
  1477.    }
  1478. }
  1479. function key_S_Action(who)
  1480. {
  1481.    if(who._y < stage_down_max)
  1482.    {
  1483.       if(who.states == "stand")
  1484.       {
  1485.          if(who._currentframe != 25)
  1486.          {
  1487.             who.doing = true;
  1488.             who.cross_step = 5;
  1489.             who.yspeed = 1;
  1490.             who.gotoAndStop("jump");
  1491.             play_sound("jump");
  1492.          }
  1493.       }
  1494.    }
  1495. }
  1496. function key_AD_Action(who, dir)
  1497. {
  1498.    who._xscale = dir * 100;
  1499.    who.speed_rate = dir;
  1500.    if(!who.doing)
  1501.    {
  1502.       if(who.states == "stand")
  1503.       {
  1504.          if(who._currentframe != 9)
  1505.          {
  1506.             who.gotoAndStop("move");
  1507.          }
  1508.       }
  1509.       else if(who.states == "jump")
  1510.       {
  1511.          if(who._currentframe != 25)
  1512.          {
  1513.             who.gotoAndStop("jump");
  1514.          }
  1515.       }
  1516.    }
  1517. }
  1518. function normalAction_AD(who)
  1519. {
  1520.    who.speed_rate = 0;
  1521.    if(!who.doing)
  1522.    {
  1523.       if(who.states == "stand")
  1524.       {
  1525.          if(who._currentframe != 1)
  1526.          {
  1527.             create_land_snow(who,2);
  1528.             who.gotoAndStop("stand");
  1529.          }
  1530.       }
  1531.       else if(who.states == "jump")
  1532.       {
  1533.          if(who._currentframe != 25)
  1534.          {
  1535.             who.gotoAndStop("jump");
  1536.          }
  1537.       }
  1538.    }
  1539. }
  1540. function key_J_Action(who)
  1541. {
  1542.    var _loc2_ = false;
  1543.    for(var _loc3_ in bg)
  1544.    {
  1545.       if(bg[_loc3_].living)
  1546.       {
  1547.          if(bg[_loc3_].iceball._currentframe == 6)
  1548.          {
  1549.             if(bg[_loc3_].iceball.hitTest(who.g))
  1550.             {
  1551.                who.doing = true;
  1552.                who.gotoAndStop("kick");
  1553.                play_sound("santa_kick");
  1554.                create_big_snow(who,2,8,80);
  1555.                rollAction(bg[_loc3_],who._xscale / 100);
  1556.                _loc2_ = true;
  1557.                break;
  1558.             }
  1559.          }
  1560.       }
  1561.    }
  1562.    if(!_loc2_)
  1563.    {
  1564.       if(who._currentframe != 17)
  1565.       {
  1566.          who.doing = true;
  1567.          who.gotoAndStop("shoot");
  1568.       }
  1569.       else if(who.ready)
  1570.       {
  1571.          who.mc.gotoAndPlay(2);
  1572.       }
  1573.    }
  1574. }
  1575. function shootAction(where, point)
  1576. {
  1577.    play_sound("shoot_sound");
  1578.    var _loc5_ = bg.getNextHighestDepth();
  1579.    var _loc3_ = bg.attachMovie("shoot","shoot",_loc5_);
  1580.    _loc3_._xscale = where._xscale;
  1581.    _loc3_._x = get_map_point(point)[0];
  1582.    _loc3_._y = get_map_point(point)[1];
  1583.    if(game_power > 1)
  1584.    {
  1585.       _loc3_._xscale *= 1.5;
  1586.       _loc3_._yscale *= 1.5;
  1587.    }
  1588.    _loc3_.shoot_count = 0;
  1589.    _loc3_.xspeed = game_range;
  1590.    _loc3_.yspeed = 0;
  1591.    _loc3_.onEnterFrame = function()
  1592.    {
  1593.       if(!_root.game_paused)
  1594.       {
  1595.          if(this.can_go)
  1596.          {
  1597.             if(this._x < 0 or this._x > 550)
  1598.             {
  1599.                this.removeMovieClip();
  1600.             }
  1601.             else if(++this.shoot_count > 7)
  1602.             {
  1603.                if(this.shined)
  1604.                {
  1605.                   this.play();
  1606.                }
  1607.                else
  1608.                {
  1609.                   this.shined = true;
  1610.                   var _loc4_ = new Color(this);
  1611.                   _loc4_.setTransform(shine_Transform2);
  1612.                }
  1613.             }
  1614.             else
  1615.             {
  1616.                this.yspeed += 0.75;
  1617.                this._x += this.xspeed * this._xscale / 100;
  1618.                this._y += this.yspeed;
  1619.                this._rotation += this._xscale / 20;
  1620.                for(var _loc3_ in bg)
  1621.                {
  1622.                   if(bg[_loc3_].g.hitTest(this._x,this._y,true))
  1623.                   {
  1624.                      if(bg[_loc3_]._name != "santa")
  1625.                      {
  1626.                         bg[_loc3_].to_die();
  1627.                         create_big_snow(this,1,8,40);
  1628.                         this.removeMovieClip();
  1629.                         break;
  1630.                      }
  1631.                   }
  1632.                }
  1633.             }
  1634.          }
  1635.       }
  1636.    };
  1637. }
  1638. function rollAction(who, dir)
  1639. {
  1640.    if(who.living)
  1641.    {
  1642.       who.living = false;
  1643.       who.mc.stop();
  1644.       who.dir = dir;
  1645.       who.speed = 12;
  1646.       who.mc._y += 30;
  1647.       who.iceball._y += 30;
  1648.       who._y -= 30;
  1649.       who.hit_count = 0;
  1650.       who.kill_count = 0;
  1651.       who.explode = function()
  1652.       {
  1653.          this.mc._visible = 0;
  1654.          this.iceball.play();
  1655.          var _loc5_ = create_big_snow(this,4,10,80);
  1656.          if(monsters_exist <= 1)
  1657.          {
  1658.             _loc5_.myMission = function()
  1659.             {
  1660.                next_game();
  1661.             };
  1662.          }
  1663.          delete this.onEnterFrame;
  1664.          if(game_stage <= 4)
  1665.          {
  1666.             add_presents(this,"presents",8 + this.kill_count);
  1667.             if(this.kill_count >= monster_all - 1)
  1668.             {
  1669.                var _loc4_ = bg.attachMovie("presents","level_presents",bg.getNextHighestDepth());
  1670.                _loc4_._x = 275;
  1671.                _loc4_._y = -10;
  1672.                _loc4_.gotoAndStop("cbox");
  1673.                _loc4_.yspeed = 3;
  1674.                _loc4_.find_count = 0;
  1675.                _loc4_.show_score = function(which)
  1676.                {
  1677.                   var _loc5_ = 100000 + this.score;
  1678.                   var _loc4_ = this.score.toString().length;
  1679.                   if(which > _loc4_)
  1680.                   {
  1681.                      this["num" + which]._visible = 0;
  1682.                   }
  1683.                   else
  1684.                   {
  1685.                      var _loc3_ = Number(_loc5_.toString().slice(6 - which,7 - which));
  1686.                      this["num" + which].gotoAndStop(_loc3_ + 1);
  1687.                   }
  1688.                };
  1689.                _loc4_.onEnterFrame = function()
  1690.                {
  1691.                   if(!_root.game_paused)
  1692.                   {
  1693.                      if(this.hitTest(bg.santa.g))
  1694.                      {
  1695.                         game_score += Number(this.score);
  1696.                         adjust_score(_root.game_ui);
  1697.                         this.gotoAndStop("score");
  1698.                         play_sound("bonus_sound");
  1699.                         this.onEnterFrame = function()
  1700.                         {
  1701.                            if(!_root.game_paused)
  1702.                            {
  1703.                               this._y -= 2;
  1704.                               if(++this.find_count == 20)
  1705.                               {
  1706.                                  this.removeMovieClip();
  1707.                               }
  1708.                            }
  1709.                         };
  1710.                      }
  1711.                      else
  1712.                      {
  1713.                         this.yspeed += 1;
  1714.                         this._y += this.yspeed;
  1715.                         if(this._y > 275)
  1716.                         {
  1717.                            this.gotoAndStop("obox");
  1718.                            create_big_snow(this,2,5,50);
  1719.                            mission_end_count += 50;
  1720.                            var _loc3_ = 0;
  1721.                            while(_loc3_ <= 10)
  1722.                            {
  1723.                               add_presents(this,"presents",random(13) + 1);
  1724.                               _loc3_ = _loc3_ + 1;
  1725.                            }
  1726.                            this.onEnterFrame = function()
  1727.                            {
  1728.                               if(--this._alpha < 5)
  1729.                               {
  1730.                                  this.removeMovieClip();
  1731.                               }
  1732.                            };
  1733.                         }
  1734.                      }
  1735.                   }
  1736.                };
  1737.             }
  1738.          }
  1739.          else
  1740.          {
  1741.             add_presents(this,"presents",random(8) + 1);
  1742.          }
  1743.       };
  1744.       who.onEnterFrame = function()
  1745.       {
  1746.          if(!_root.game_paused)
  1747.          {
  1748.             moveAction(this,this.dir * this.speed,0);
  1749.             this._rotation += this.dir * 30;
  1750.             var _loc4_ = false;
  1751.             if(this.hit_blocks)
  1752.             {
  1753.                _loc4_ = true;
  1754.             }
  1755.             else if(this._x + this.dir * this.speed < 30)
  1756.             {
  1757.                _loc4_ = true;
  1758.             }
  1759.             else if(this._x + this.dir * this.speed > 520)
  1760.             {
  1761.                _loc4_ = true;
  1762.             }
  1763.             if(_loc4_)
  1764.             {
  1765.                this.dir *= -1;
  1766.                if(this._y > stage_down_max)
  1767.                {
  1768.                   this.hit_count += 3;
  1769.                }
  1770.                else
  1771.                {
  1772.                   this.hit_count = this.hit_count + 1;
  1773.                }
  1774.                play_sound("ball_hit");
  1775.             }
  1776.             if(this.hit_count >= 5)
  1777.             {
  1778.                this.explode();
  1779.             }
  1780.             else
  1781.             {
  1782.                for(var _loc3_ in bg)
  1783.                {
  1784.                   if(bg[_loc3_].attack != undefined and bg[_loc3_].living)
  1785.                   {
  1786.                      if(bg[_loc3_]._name != this._name and bg[_loc3_]._name != "santa")
  1787.                      {
  1788.                         if(bg[_loc3_].g.hitTest(this.iceball))
  1789.                         {
  1790.                            bg[_loc3_].monster_dead();
  1791.                            play_sound("ball_crash");
  1792.                            if(bg[_loc3_].typ != "boss")
  1793.                            {
  1794.                               this.kill_count = this.kill_count + 1;
  1795.                            }
  1796.                            else
  1797.                            {
  1798.                               this.explode();
  1799.                            }
  1800.                            break;
  1801.                         }
  1802.                      }
  1803.                   }
  1804.                }
  1805.             }
  1806.          }
  1807.       };
  1808.    }
  1809. }
  1810. function get_map_point(which)
  1811. {
  1812.    if(which != undefined)
  1813.    {
  1814.       var _loc1_ = new Object();
  1815.       _loc1_.x = which._x;
  1816.       _loc1_.y = which._y;
  1817.       which._parent.localToGlobal(_loc1_);
  1818.       var _loc2_ = [];
  1819.       _loc2_[0] = _loc1_.x;
  1820.       _loc2_[1] = _loc1_.y;
  1821.       return _loc2_;
  1822.    }
  1823. }
  1824. function bossAI1(who)
  1825. {
  1826.    who.states = "stand";
  1827.    who.living = true;
  1828.    who.xspeed = -6;
  1829.    who.blood = game_boss1_health;
  1830.    who.attack = true;
  1831.    who.typ = "boss";
  1832.    who.turn = function()
  1833.    {
  1834.       this.xspeed *= -1;
  1835.    };
  1836.    who.get_blocked = function()
  1837.    {
  1838.       if(this.living)
  1839.       {
  1840.          this.turn();
  1841.       }
  1842.    };
  1843.    who.stand = function()
  1844.    {
  1845.       this.gotoAndStop("stand");
  1846.       this.action_count = 0;
  1847.       this.onEnterFrame = function()
  1848.       {
  1849.          if(!_root.game_paused)
  1850.          {
  1851.             if(++this.action_count == 30)
  1852.             {
  1853.                if(monsters_exist <= 1)
  1854.                {
  1855.                   this.summon();
  1856.                }
  1857.                else if(!random(2))
  1858.                {
  1859.                   this.move_me();
  1860.                }
  1861.                else
  1862.                {
  1863.                   this.jump();
  1864.                }
  1865.             }
  1866.          }
  1867.       };
  1868.    };
  1869.    who.jump = function()
  1870.    {
  1871.       this.gotoAndStop("jump");
  1872.       this.cross_step = 25;
  1873.       this.onEnterFrame = function()
  1874.       {
  1875.          if(!_root.game_paused)
  1876.          {
  1877.             moveAction(this,0,-20);
  1878.             if(this.states == "stand")
  1879.             {
  1880.                create_land_snow(this);
  1881.                if(!random(2))
  1882.                {
  1883.                   this.move_me();
  1884.                }
  1885.                else
  1886.                {
  1887.                   this.stand();
  1888.                }
  1889.             }
  1890.          }
  1891.       };
  1892.    };
  1893.    who.move_me = function()
  1894.    {
  1895.       this.gotoAndStop("walk");
  1896.       this.action_count = 0;
  1897.       this.onEnterFrame = function()
  1898.       {
  1899.          if(!_root.game_paused)
  1900.          {
  1901.             moveAction(this,this.xspeed,0);
  1902.             if(this._x + this.xspeed > stage_max)
  1903.             {
  1904.                this.turn();
  1905.             }
  1906.             else if(this._x + this.xspeed < stage_min)
  1907.             {
  1908.                this.turn();
  1909.             }
  1910.             else if(this.hit_blocks)
  1911.             {
  1912.                this.turn();
  1913.             }
  1914.             if(this.states == "stand")
  1915.             {
  1916.                if(++this.action_count == 150)
  1917.                {
  1918.                   this.stand();
  1919.                }
  1920.             }
  1921.          }
  1922.       };
  1923.    };
  1924.    who.summon = function()
  1925.    {
  1926.       this.gotoAndStop("summon");
  1927.       this.action_count = 0;
  1928.       create_monsters(random(3) + 1,90,-100 - random(100));
  1929.       create_monsters(random(3) + 1,270,-100 - random(100));
  1930.       create_monsters(random(3) + 1,450,-100 - random(100));
  1931.       monsters_exist += 3;
  1932.       monster_all = monsters_exist;
  1933.       this.onEnterFrame = function()
  1934.       {
  1935.          if(!_root.game_paused)
  1936.          {
  1937.             if(++this.action_count > 50)
  1938.             {
  1939.                if(!random(2))
  1940.                {
  1941.                   this.move_me();
  1942.                }
  1943.                else
  1944.                {
  1945.                   this.jump();
  1946.                }
  1947.             }
  1948.          }
  1949.       };
  1950.    };
  1951.    who.monster_dead = function()
  1952.    {
  1953.       delete this.onEnterFrame;
  1954.       if(--this.blood > 0)
  1955.       {
  1956.          this.action_count = 0;
  1957.          this.gotoAndStop("hit");
  1958.          this.onEnterFrame = function()
  1959.          {
  1960.             if(!_root.game_paused)
  1961.             {
  1962.                if(++this.action_count > 30)
  1963.                {
  1964.                   this.move_me();
  1965.                }
  1966.             }
  1967.          };
  1968.       }
  1969.       else
  1970.       {
  1971.          monsters_exist--;
  1972.          boss_all_kill();
  1973.          mission_end_count += 50;
  1974.          var _loc3_ = 0;
  1975.          while(_loc3_ <= 10)
  1976.          {
  1977.             add_presents(this,"presents",random(13) + 1);
  1978.             _loc3_ = _loc3_ + 1;
  1979.          }
  1980.          this.gotoAndStop("die");
  1981.       }
  1982.       _root["game_boss" + game_level + "_health"] = this.blood;
  1983.       adjust_boss(_root.game_ui);
  1984.    };
  1985.    who.stand();
  1986. }
  1987. function boss_all_kill()
  1988. {
  1989.    play_music("music_win",true);
  1990.    for(var _loc1_ in bg)
  1991.    {
  1992.       if(bg[_loc1_].typ != "boss")
  1993.       {
  1994.          if(bg[_loc1_]._name != "santa")
  1995.          {
  1996.             if(bg[_loc1_].attack != undefined)
  1997.             {
  1998.                if(bg[_loc1_].living)
  1999.                {
  2000.                   bg[_loc1_].monster_dead();
  2001.                }
  2002.             }
  2003.          }
  2004.       }
  2005.    }
  2006. }
  2007. function bossAI2(who)
  2008. {
  2009.    who.states = "stand";
  2010.    who.living = true;
  2011.    who.xspeed = -3;
  2012.    who.blood = game_boss2_health;
  2013.    who.attack = true;
  2014.    who.typ = "boss";
  2015.    who.turn = function()
  2016.    {
  2017.       this.xspeed *= -1;
  2018.    };
  2019.    who.get_blocked = function()
  2020.    {
  2021.       if(this.living)
  2022.       {
  2023.          this.turn();
  2024.       }
  2025.    };
  2026.    who.stand = function()
  2027.    {
  2028.       this.gotoAndStop("stand");
  2029.       this.action_count = 0;
  2030.       this.onEnterFrame = function()
  2031.       {
  2032.          if(!_root.game_paused)
  2033.          {
  2034.             if(++this.action_count == 30)
  2035.             {
  2036.                if(monsters_exist <= 1)
  2037.                {
  2038.                   this.summon();
  2039.                }
  2040.                else if(!random(2))
  2041.                {
  2042.                   this.move_me();
  2043.                }
  2044.                else
  2045.                {
  2046.                   this.attacking();
  2047.                }
  2048.             }
  2049.          }
  2050.       };
  2051.    };
  2052.    who.move_me = function()
  2053.    {
  2054.       this.gotoAndStop("walk");
  2055.       this.onEnterFrame = function()
  2056.       {
  2057.          if(!_root.game_paused)
  2058.          {
  2059.             moveAction(this,this.xspeed,0);
  2060.             if(this._x + this.xspeed > stage_max - 50)
  2061.             {
  2062.                this.turn();
  2063.             }
  2064.             else if(this._x + this.xspeed < stage_min + 50)
  2065.             {
  2066.                this.turn();
  2067.             }
  2068.             else if(this.hit_blocks)
  2069.             {
  2070.                this.turn();
  2071.             }
  2072.             if(this.states == "stand")
  2073.             {
  2074.                if(Math.abs(this._x - bg.santa._x) < 20)
  2075.                {
  2076.                   this.attacking();
  2077.                }
  2078.                else if(!random(250))
  2079.                {
  2080.                   this.stand();
  2081.                }
  2082.             }
  2083.          }
  2084.       };
  2085.    };
  2086.    who.attacking = function()
  2087.    {
  2088.       this.gotoAndStop("attack");
  2089.       this.action_count = 0;
  2090.       this.onEnterFrame = function()
  2091.       {
  2092.          if(!_root.game_paused)
  2093.          {
  2094.             if(++this.action_count > 43)
  2095.             {
  2096.                this.stand();
  2097.             }
  2098.          }
  2099.       };
  2100.    };
  2101.    who.attackAction = function()
  2102.    {
  2103.       var _loc4_ = bg.getNextHighestDepth();
  2104.       var _loc3_ = bg.attachMovie("iceball","boss2iceball_" + _loc4_,_loc4_);
  2105.       _loc3_._x = this._x;
  2106.       _loc3_._y = this._y - 80;
  2107.       _loc3_.gotoAndStop(4);
  2108.       _loc3_.onEnterFrame = function()
  2109.       {
  2110.          if(!_root.game_paused)
  2111.          {
  2112.             if(this.hitTest(bg.santa.g))
  2113.             {
  2114.                bg.santa.to_die();
  2115.                this.gotoAndPlay(7);
  2116.                delete this.onEnterFrame;
  2117.             }
  2118.             this._y += 25;
  2119.             if(this._y > 500)
  2120.             {
  2121.                this.removeMovieClip();
  2122.             }
  2123.          }
  2124.       };
  2125.    };
  2126.    who.summon = function()
  2127.    {
  2128.       this.gotoAndStop("summon");
  2129.       this.action_count = 0;
  2130.       create_monsters(random(5) + 1,34,58);
  2131.       create_monsters(random(5) + 1,516,58);
  2132.       create_monsters(random(5) + 1,108,130);
  2133.       create_monsters(random(5) + 1,443,130);
  2134.       monsters_exist += 4;
  2135.       monster_all = monsters_exist;
  2136.       this.onEnterFrame = function()
  2137.       {
  2138.          if(!_root.game_paused)
  2139.          {
  2140.             if(++this.action_count > 44)
  2141.             {
  2142.                this.stand();
  2143.             }
  2144.          }
  2145.       };
  2146.    };
  2147.    who.monster_dead = function()
  2148.    {
  2149.       delete this.onEnterFrame;
  2150.       if(--this.blood > 0)
  2151.       {
  2152.          this.action_count = 0;
  2153.          this.gotoAndStop("hit");
  2154.          this.onEnterFrame = function()
  2155.          {
  2156.             if(!_root.game_paused)
  2157.             {
  2158.                if(++this.action_count > 30)
  2159.                {
  2160.                   this.move_me();
  2161.                }
  2162.             }
  2163.          };
  2164.       }
  2165.       else
  2166.       {
  2167.          monsters_exist--;
  2168.          boss_all_kill();
  2169.          mission_end_count += 50;
  2170.          var _loc3_ = 0;
  2171.          while(_loc3_ <= 10)
  2172.          {
  2173.             add_presents(this,"presents",random(13) + 1);
  2174.             _loc3_ = _loc3_ + 1;
  2175.          }
  2176.          this.gotoAndStop("die");
  2177.       }
  2178.       _root["game_boss" + game_level + "_health"] = this.blood;
  2179.       adjust_boss(_root.game_ui);
  2180.    };
  2181.    who.stand();
  2182. }
  2183. function bossAI3(who)
  2184. {
  2185.    who.states = "stand";
  2186.    who.living = true;
  2187.    who.blood = game_boss3_health;
  2188.    who.attack = true;
  2189.    who.typ = "boss";
  2190.    who.stand_array = [[275,123],[72,103],[485,103]];
  2191.    who.stand = function()
  2192.    {
  2193.       this.gotoAndStop("stand");
  2194.       this.action_count = 0;
  2195.       this.onEnterFrame = function()
  2196.       {
  2197.          if(!_root.game_paused)
  2198.          {
  2199.             if(++this.action_count == 50)
  2200.             {
  2201.                if(monsters_exist <= 1)
  2202.                {
  2203.                   this.summon();
  2204.                }
  2205.                else
  2206.                {
  2207.                   this.kiss();
  2208.                }
  2209.             }
  2210.          }
  2211.       };
  2212.    };
  2213.    who.kiss = function()
  2214.    {
  2215.       this.gotoAndStop("attack");
  2216.       this.action_count = 0;
  2217.       this.onEnterFrame = function()
  2218.       {
  2219.          if(!_root.game_paused)
  2220.          {
  2221.             if(this.g.hitTest(bg.santa.g))
  2222.             {
  2223.                bg.santa.to_die();
  2224.             }
  2225.             if(++this.action_count > 35)
  2226.             {
  2227.                this.move_me();
  2228.             }
  2229.          }
  2230.       };
  2231.    };
  2232.    who.move_me = function()
  2233.    {
  2234.       this.gotoAndStop("fly");
  2235.       if(this.attack)
  2236.       {
  2237.          this.target_x = bg.santa._x;
  2238.          this.target_y = bg.santa._y + 15;
  2239.          this.onEnterFrame = function()
  2240.          {
  2241.             if(!_root.game_paused)
  2242.             {
  2243.                this._x += (this.target_x - this._x) / 20;
  2244.                this._y += (this.target_y - this._y) / 20;
  2245.                if(this.g.hitTest(bg.santa.g))
  2246.                {
  2247.                   bg.santa.to_die();
  2248.                }
  2249.                if(Math.abs(this.target_y - this._y) < 5)
  2250.                {
  2251.                   this.attack = false;
  2252.                   this.move_me();
  2253.                }
  2254.             }
  2255.          };
  2256.       }
  2257.       else
  2258.       {
  2259.          var _loc3_ = this.stand_array[random(3)];
  2260.          this.target_x = _loc3_[0];
  2261.          this.target_y = _loc3_[1];
  2262.          this.onEnterFrame = function()
  2263.          {
  2264.             if(!_root.game_paused)
  2265.             {
  2266.                this._x += (this.target_x - this._x) / 20;
  2267.                this._y += (this.target_y - this._y) / 20;
  2268.                if(this.g.hitTest(bg.santa.g))
  2269.                {
  2270.                   bg.santa.to_die();
  2271.                }
  2272.                if(Math.abs(this.target_x - this._x) < 5)
  2273.                {
  2274.                   if(Math.abs(this.target_y - this._y) < 5)
  2275.                   {
  2276.                      this.attack = true;
  2277.                      this.stand();
  2278.                   }
  2279.                }
  2280.             }
  2281.          };
  2282.       }
  2283.    };
  2284.    who.summon = function()
  2285.    {
  2286.       this.gotoAndStop("summon");
  2287.       this.action_count = 0;
  2288.       create_monsters(random(6) + 1,90,230 + random(120));
  2289.       create_monsters(random(6) + 1,180,230 + random(120));
  2290.       create_monsters(random(6) + 1,270,230 + random(120));
  2291.       create_monsters(random(6) + 1,360,230 + random(120));
  2292.       create_monsters(random(6) + 1,450,230 + random(120));
  2293.       monsters_exist += 5;
  2294.       monster_all = monsters_exist;
  2295.       this.onEnterFrame = function()
  2296.       {
  2297.          if(!_root.game_paused)
  2298.          {
  2299.             if(++this.action_count > 50)
  2300.             {
  2301.                this.stand();
  2302.             }
  2303.          }
  2304.       };
  2305.    };
  2306.    who.monster_dead = function()
  2307.    {
  2308.       delete this.onEnterFrame;
  2309.       if(--this.blood > 0)
  2310.       {
  2311.          this.action_count = 0;
  2312.          this.gotoAndStop("hit");
  2313.          this.onEnterFrame = function()
  2314.          {
  2315.             if(!_root.game_paused)
  2316.             {
  2317.                if(++this.action_count > 30)
  2318.                {
  2319.                   this.attack = false;
  2320.                   this.move_me();
  2321.                }
  2322.             }
  2323.          };
  2324.       }
  2325.       else
  2326.       {
  2327.          monsters_exist--;
  2328.          boss_all_kill();
  2329.          mission_end_count += 50;
  2330.          var _loc3_ = 0;
  2331.          while(_loc3_ <= 10)
  2332.          {
  2333.             add_presents(this,"presents",random(13) + 1);
  2334.             _loc3_ = _loc3_ + 1;
  2335.          }
  2336.          this.gotoAndStop("die");
  2337.       }
  2338.       _root["game_boss" + game_level + "_health"] = this.blood;
  2339.       adjust_boss(_root.game_ui);
  2340.    };
  2341.    who.stand();
  2342. }
  2343. function bossAI4(who)
  2344. {
  2345.    who.states = "stand";
  2346.    who.living = true;
  2347.    who.blood = game_boss4_health;
  2348.    who.attack = true;
  2349.    who.typ = "boss";
  2350.    who.stand = function()
  2351.    {
  2352.       this.gotoAndStop("stand");
  2353.       this.action_count = 0;
  2354.       this.onEnterFrame = function()
  2355.       {
  2356.          if(!_root.game_paused)
  2357.          {
  2358.             if(++this.action_count == 50)
  2359.             {
  2360.                if(monsters_exist <= 1)
  2361.                {
  2362.                   this.summon();
  2363.                }
  2364.                else if(!random(2))
  2365.                {
  2366.                   this.move_me();
  2367.                }
  2368.                else
  2369.                {
  2370.                   this.tracing();
  2371.                }
  2372.             }
  2373.          }
  2374.       };
  2375.    };
  2376.    who.move_me = function()
  2377.    {
  2378.       this.gotoAndStop("move");
  2379.       this.action_count = 0;
  2380.       this.onEnterFrame = function()
  2381.       {
  2382.          if(!_root.game_paused)
  2383.          {
  2384.             this.action_count = this.action_count + 1;
  2385.             if(this.action_count == 5)
  2386.             {
  2387.                this._alpha = 40;
  2388.             }
  2389.             else if(this.action_count == 15)
  2390.             {
  2391.                this._alpha = 0;
  2392.                this._x = random(450) + 50;
  2393.                this._y = random(200) + 150;
  2394.             }
  2395.             else if(this.action_count == 20)
  2396.             {
  2397.                this._alpha = 40;
  2398.             }
  2399.             else if(this.action_count == 30)
  2400.             {
  2401.                this._alpha = 100;
  2402.                this.stand();
  2403.             }
  2404.          }
  2405.       };
  2406.    };
  2407.    who.tracing = function()
  2408.    {
  2409.       this.gotoAndStop("trace");
  2410.       this.onEnterFrame = function()
  2411.       {
  2412.          if(!_root.game_paused)
  2413.          {
  2414.             if(this.g.hitTest(bg.santa.g))
  2415.             {
  2416.                bg.santa.to_die();
  2417.             }
  2418.             this._x += (bg.santa._x - this._x) / 20;
  2419.             this._y += (bg.santa._y - 120 - this._y) / 20;
  2420.             if(Math.abs(bg.santa._x - this._x) < 5)
  2421.             {
  2422.                this.attacking();
  2423.             }
  2424.          }
  2425.       };
  2426.    };
  2427.    who.attacking = function()
  2428.    {
  2429.       this.gotoAndStop("attack");
  2430.       this.action_count = 0;
  2431.       var _loc3_ = bg.getNextHighestDepth();
  2432.       this.mother_mc = bg.createEmptyMovieClip("boss4iceball",_loc3_);
  2433.       this.mother_mc._x = this._x;
  2434.       this.mother_mc._y = this._y - 100;
  2435.       this.mother_mc.attachMovie("iceball","iceball_1",1);
  2436.       this.mother_mc.iceball_1._x = -50;
  2437.       this.mother_mc.iceball_1.gotoAndStop(5);
  2438.       this.mother_mc.attachMovie("iceball","iceball_2",2);
  2439.       this.mother_mc.iceball_2._x = 50;
  2440.       this.mother_mc.iceball_2.gotoAndStop(5);
  2441.       var _loc4_ = new Color(this.mother_mc);
  2442.       _loc4_.setTransform(shine_Transform2);
  2443.       this.mother_mc._xscale = 10;
  2444.       this.mother_mc._yscale = 10;
  2445.       this.mother_mc.onEnterFrame = function()
  2446.       {
  2447.          if(!_root.game_paused)
  2448.          {
  2449.             if(this._xscale > 100)
  2450.             {
  2451.                this._xscale = 100;
  2452.                var _loc3_ = new Color(this);
  2453.                _loc3_.setTransform(shine_Transform1);
  2454.                this.onEnterFrame = function()
  2455.                {
  2456.                   if(!_root.game_paused)
  2457.                   {
  2458.                      if(this.hitTest(bg.santa.g))
  2459.                      {
  2460.                         bg.santa.to_die();
  2461.                         this.iceball_1.gotoAndPlay(7);
  2462.                         this.iceball_2.gotoAndPlay(7);
  2463.                         this.onEnterFrame = function()
  2464.                         {
  2465.                            if(!_root.game_paused)
  2466.                            {
  2467.                               if(this.iceball_1 == undefined)
  2468.                               {
  2469.                                  this.removeMovieClip();
  2470.                               }
  2471.                            }
  2472.                         };
  2473.                      }
  2474.                   }
  2475.                   this._y += 10;
  2476.                   if(this._y > 500)
  2477.                   {
  2478.                      this.removeMovieClip();
  2479.                   }
  2480.                };
  2481.             }
  2482.             this._xscale += 10;
  2483.             this._yscale += 10;
  2484.          }
  2485.       };
  2486.       this.onEnterFrame = function()
  2487.       {
  2488.          if(!_root.game_paused)
  2489.          {
  2490.             this.action_count = this.action_count + 1;
  2491.             if(this.action_count > 32)
  2492.             {
  2493.                this.stand();
  2494.             }
  2495.          }
  2496.       };
  2497.    };
  2498.    who.summon = function()
  2499.    {
  2500.       this.gotoAndStop("summon");
  2501.       this.action_count = 0;
  2502.       create_monsters(random(8) + 1,60 + random(160),225);
  2503.       create_monsters(random(8) + 1,340 + random(160),225);
  2504.       monsters_exist += 2;
  2505.       monster_all = monsters_exist;
  2506.       this.onEnterFrame = function()
  2507.       {
  2508.          if(!_root.game_paused)
  2509.          {
  2510.             if(++this.action_count > 25)
  2511.             {
  2512.                this.stand();
  2513.             }
  2514.          }
  2515.       };
  2516.    };
  2517.    who.revenge = function()
  2518.    {
  2519.       this.gotoAndStop("revenge");
  2520.       this.action_count = 0;
  2521.       this.onEnterFrame = function()
  2522.       {
  2523.          if(!_root.game_paused)
  2524.          {
  2525.             if(++this.action_count > 81)
  2526.             {
  2527.                this.stand();
  2528.             }
  2529.          }
  2530.       };
  2531.    };
  2532.    who.revenging = function()
  2533.    {
  2534.       if(random(2))
  2535.       {
  2536.          var _loc7_ = 110;
  2537.          var _loc8_ = 0;
  2538.          var _loc6_ = 5;
  2539.       }
  2540.       else
  2541.       {
  2542.          _loc7_ = 50;
  2543.          _loc8_ = 1;
  2544.          _loc6_ = 10;
  2545.       }
  2546.       var _loc4_ = _loc8_;
  2547.       while(_loc4_ <= _loc6_)
  2548.       {
  2549.          var _loc5_ = bg.getNextHighestDepth();
  2550.          var _loc3_ = bg.attachMovie("monsterboss4_weapon","monsterboss4_weapon" + _loc5_,_loc5_);
  2551.          _loc3_._x = _loc7_ * _loc4_;
  2552.          _loc3_._y = -80 - random(150);
  2553.          _loc3_.gotoAndStop(4);
  2554.          _loc3_.onEnterFrame = function()
  2555.          {
  2556.             if(!_root.game_paused)
  2557.             {
  2558.                if(!this.attacked)
  2559.                {
  2560.                   if(this.hitTest(bg.santa.g))
  2561.                   {
  2562.                      this.attacked = true;
  2563.                      bg.santa.to_die();
  2564.                   }
  2565.                }
  2566.                this._y += 15;
  2567.                if(this._y > 500)
  2568.                {
  2569.                   this.removeMovieClip();
  2570.                }
  2571.             }
  2572.          };
  2573.          _loc4_ = _loc4_ + 1;
  2574.       }
  2575.    };
  2576.    who.monster_dead = function()
  2577.    {
  2578.       this._alpha = 100;
  2579.       delete this.onEnterFrame;
  2580.       if(--this.blood > 0)
  2581.       {
  2582.          this.action_count = 0;
  2583.          this.gotoAndStop("hit");
  2584.          this.onEnterFrame = function()
  2585.          {
  2586.             if(!_root.game_paused)
  2587.             {
  2588.                if(++this.action_count > 30)
  2589.                {
  2590.                   this.revenge();
  2591.                }
  2592.             }
  2593.          };
  2594.       }
  2595.       else
  2596.       {
  2597.          monsters_exist--;
  2598.          boss_all_kill();
  2599.          mission_end_count += 50;
  2600.          var _loc3_ = 0;
  2601.          while(_loc3_ <= 30)
  2602.          {
  2603.             add_presents(this,"presents",random(13) + 1);
  2604.             _loc3_ = _loc3_ + 1;
  2605.          }
  2606.          this.gotoAndStop("die");
  2607.       }
  2608.       _root["game_boss" + game_level + "_health"] = this.blood;
  2609.       adjust_boss(_root.game_ui);
  2610.    };
  2611.    who.stand();
  2612. }
  2613. function play_music(what, cyc)
  2614. {
  2615.    if(this[what] == undefined)
  2616.    {
  2617.       this[what] = new Sound();
  2618.       this[what].attachSound(what);
  2619.    }
  2620.    if(game_music)
  2621.    {
  2622.       if(now_music != what or music_resume)
  2623.       {
  2624.          now_music = what;
  2625.          music_resume = false;
  2626.          stopAllSounds();
  2627.          if(!cyc)
  2628.          {
  2629.             this[what].start();
  2630.          }
  2631.          else
  2632.          {
  2633.             this[what].start(0,999999);
  2634.          }
  2635.       }
  2636.    }
  2637. }
  2638. function play_sound(what)
  2639. {
  2640.    if(this[what] == undefined)
  2641.    {
  2642.       this[what] = new Sound();
  2643.       this[what].attachSound(what);
  2644.    }
  2645.    if(game_music)
  2646.    {
  2647.       this[what].stop(what);
  2648.       this[what].start();
  2649.    }
  2650. }
  2651. _root.score = 0;
  2652. game_score = 0;
  2653. Stage.scaleMode = "noScale";
  2654. myMenu = new ContextMenu();
  2655. myMenu.hideBuiltInItems();
  2656. _root.menu = myMenu;
  2657. getURL("FSCommand:trapallkeys",true);
  2658. game_paused = true;
  2659. game_music = true;
  2660. music_resume = false;
  2661. game_level = 1;
  2662. game_stage = 0;
  2663. stage_max = 525;
  2664. stage_min = 25;
  2665. stage_down_max = 325;
  2666. monsters_exist = 0;
  2667. monster_all = 0;
  2668. game_score = 0;
  2669. game_life = 10;
  2670. game_power = org_game_power = 1;
  2671. game_range = org_game_range = 12;
  2672. game_speed = org_game_speed = 4;
  2673. game_boss1_health = 5;
  2674. game_boss2_health = 8;
  2675. game_boss3_health = 8;
  2676. game_boss4_health = 10;
  2677. game_time = 60;
  2678. shine_Transform1 = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
  2679. shine_Transform2 = {ra:0,rb:255,ga:0,gb:255,ba:0,bb:255,aa:100,ab:0};
  2680. Acode = org_Acode = 37;
  2681. Dcode = org_Dcode = 39;
  2682. Wcode = org_Wcode = 38;
  2683. Scode = org_Scode = 40;
  2684. Jcode = org_Jcode = 32;
  2685.